package com.niiwoo.civet.account.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * 账单用户类型枚举
 *
 * @author xiaoyingping
 * @
 */

@AllArgsConstructor
@Getter
public enum BillUserTypeEnum {
    GENERAL((byte) 1, "普通用户"),
    COOPERATE_AGENCY((byte) 2, "合作机构"),
    GUARANTEE_AGENCY((byte) 3, "担保机构"),
    PLATFORM((byte) 4, "平台"),
    ZHIBAOJIN((byte)5,"质保金"),
    GUARANTEE_ACCOUNT((byte)6,"担保金账户"),
    ;

    private Byte code; //用户类型
    private String desc; //类型说明

    public static BillUserTypeEnum getEnumByCode(byte enumCode) {
        if (Objects.nonNull(enumCode)) {
            for (BillUserTypeEnum retEnum : BillUserTypeEnum.values()) {
                if (enumCode == retEnum.code.byteValue()) {
                    return retEnum;
                }
            }
        }
        return null;
    }

}
